<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<jsp:useBean id="now" class="java.util.Date"></jsp:useBean>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

	<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery-3.3.1.js"></script>
	<link rel="stylesheet" href="${pageContext.request.contextPath }/static/css/jquery.datetimepicker.css">
	<script src="${pageContext.request.contextPath }/static/js/jquery.datetimepicker.js"></script>
	<link rel="stylesheet" href="${pageContext.request.contextPath }/static/css/ion.calendar.css">
	<script src="${pageContext.request.contextPath }/static/js/moment.min.js"></script>
	<script src="${pageContext.request.contextPath }/static/js/moment.zh-cn.js"></script>
	<script src="${pageContext.request.contextPath }/static/js/ion.calendar.min.js"></script>
	<link rel="stylesheet" href="${pageContext.request.contextPath }/static/css/avgrund.css">
	<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/avgrund.js"></script>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/css/menu_sideslide.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/css/bootstrap.min.css" />
	<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/bootstrap.min.js"></script>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/css/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/static/css/style1.css" />
	<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/velocity.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/sideToggleExtended.js"></script>
	<link rel="shortcut icon" href="../img/favico.ico" type="image/x-icon">
	<style>
        .weather{
           margin: 30px 0 20px 30px;
        }
        .content-left{
            float: left;
            border-right: 1px solid #ddd;
            width: 100%;
            box-shadow: 2px 2px 4px #777777;
            margin-top: 3px;
        }
        .content-left-weather{
            margin: 0 auto;
            border-bottom:  1px solid #ddd;
            width: 100%;
        }
        .mynavbar{
            position: relative;
        }
        .menu-button{
            position: absolute;
            top: -10px;
            left:-5px;
        }
    </style>
    
	<script type="text/javascript">
		
        $(function(){
            $("#calendar").ionCalendar({
                lang: 'zh-cn',
                format: 'YYYY年M月D日',
                onClick: function(date){
                	var code = "<%=request.getParameter("code")%>";
                	
                	if(code==1){
                	var time=new Date(Date.parse(date.replace('年','-').replace('月','-').replace('日','')))
                    console.log(time)
                    var d=new Date(time);
                    var year=d.getFullYear();
                    var month=change(d.getMonth()+1);
                    var day=change(d.getDate());
                    var time=year+'-'+month+'-'+day;
                    
                    openDialog();
                    function change(t){
                        if(t<10){
                            return "0"+t;
                        }else{
                            return t;
                        }
                    }
                    var user="<%=request.getParameter("user")%>"
                    var param_data={
                    	'user':user,
                    	'start_date':time
                    }
                   $.ajax({
                    	type:"POST",
                        url:"${pageContext.request.contextPath }/selectSchedule.action",
                        data:{'param':JSON.stringify(param_data)},
                        dataType:"json",
                        async:false,
                        success:function(data){
                        	console.log(data)
                            if(data != ""){
           						var tbl=""
           						
           						var text3="edit_sch"
                       		 	for(var i=0;i<data.length;i++){
                       		 	var text1="${pageContext.request.contextPath }/deleteSchedule.action?id="+data[i].id
               					var text2="${pageContext.request.contextPath }/SelectOne.action?id="+data[i].id
                       			 tbl+="<p><span>主题</span>：<span>"+data[i].theme+"</span></p><p><span>开始时间</span>：<span>"+data[i].start_date+" "+data[i].start_time+"</span></p><p><span>结束时间</span>：<span>"+data[i].end_date+" "+data[i].end_time+"</span></p><p><span>人员</span>：<span>"+data[i].staff+"</span></p><p><span>说明</span>：<span>"+data[i].instruction +"</span></p>"+"<p><a href='"+text1+"' class='margin-right:15px'>删除</a>"+"<a href='"+text2+"' class='"+text3+"'>修改</a></p>"
                       		}  		    	
                 		     $(".detail_content").html(tbl);
                            }else{       
                            	$(".detail_content").html("您没有添加事件");
                            }
                        }
                    });
                }else{
                	//alert("您还未登录！");
                }
                }
            
            });
            
        });


	</script>
	<script type="text/javascript">

        function openDialog() {
            Avgrund.show( "#default-popup" );
        }

        function closeDialog() {
            Avgrund.hide();
        }

	</script>
	
	
	<script type="text/javascript">
        $(document).ready(function(){
        	var code = "<%=request.getParameter("code")%>";
        	if(code==0){
        		 
                var ch22 = document.getElementById("login");
                ch22.style.visibility="visible";
        	}else if(code==1){
        		
                 
                var ch22 = document.getElementById("login");
                ch22.style.visibility="hidden";
                
              
        	}
        	
        	
        });
    </script> 
    <script type="text/javascript">
    $(function () {
    	
		
		
		
		 $(".friend-list").click(function(){
		  		
			    var user="<%=request.getParameter("user") %>";
			    
		  		$.ajax({        			
		  			type:"GET",
		  		    url:"/Schedule/FindFriends.action",
		  		    contentType:"application/json;charset=utf-8",  
		  		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		  		    data:{
		  		    	'user':user
		  		    },
		  		    dataType:"json",
		  		    async:false,
		  		    success:function(result){
		  		    	   	
		  		    	    if(result.code==1){
		  		    	    	
				    	    	var data=result.data;
				    	    	//console.log(data);
				    	    	var tbl = "<ul class='list-unstyled'>";
		             		    for(var i=0;i<data.length;i++){
		             		    	//console.log(data[i].avatar);
		             		    	var img = '';
		             		    	if(data[i].avatar === undefined){
		             		    		img = '../img/touxiang.jpg';
		             		    	}else{
		             		    		img = '/image/'+data[i].avatar;
		             		    	}
		             		    tbl += "<li class='media' style='border-bottom:1px solid #e8e8e8'>"
		             			tbl+="<img class='mr-3' src='"+img+"' style='width:60px;height:60px;border-radius:50%;margin-top:12px;border:1px solid #e8e8e8'> "
		             			tbl+="<div class='media-body'style='position:relative'>"
		             			tbl+="<h5 class='mt-0' style='padding-top:20px;font-size:16px'>"+data[i].name+"</h5><p class='delete-phone' style='font-size:14px'>"+data[i].phone+"</p><input type='button' style='position:absolute;bottom:20px;right:10px'  class='drop float-right btn btn-primary btn-sm' value='删除'></div></li>"
		             			
		             		 } 
		             		    tbl +="</ul>"
		          		       $("#table_show").html(tbl);
				    	    }
		  		    }        		    
		  		});   //ajax
		  		
		  		
		  		
		  		$(".drop").click(function(){
		  			var phone=$(".delete-phone").html();
		  			//alert(phone);
		  			var send="<%=request.getParameter("user")%>";
		  			
		  			param_data={
		  				'send':send,
		  				'phone':phone
		  			}
		  		    $.ajax({        			
		    			type:"GET",
		    		    url:"/Schedule/deleteFriends2.action",
		    		    contentType:"application/json;charset=utf-8",  
		    		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		    		    data:{
		    		    	'param':JSON.stringify(param_data)
		    		    },
		    		    dataType:"json",
		    		    async:false,
		    		    success:function(result){
		    		    	if(result.code==1){
	        		    		//alert("删除成功");
	        		    	}
		    		    	
		    		     
		    		    }  //success	
		    		 });   //ajax
		  			
		  		});//drop
		  		
		  		$(".drop").click(function(){
		  			var phone=$(".delete-phone").html();
		  			//alert(phone);
		  			var user="<%=request.getParameter("user")%>";
		  			param_data={
		  				'user':user,
		  				'phone':phone
		  			}
		  		    $.ajax({        			
		    			type:"GET",
		    		    url:"/Schedule/deleteFriends.action",
		    		    contentType:"application/json;charset=utf-8",  
		    		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		    		    data:{
		    		    	'param':JSON.stringify(param_data)
		    		    },
		    		    dataType:"json",
		    		    async:false,
		    		    success:function(result){
		    		    	if(result.code==1){
	        		    		alert("删除成功");
	        		    	}
		    		    	
		    		     
		    		    }  //success	
		    		 });   //ajax
		  			
		  		});//drop
		  		
		 	
		    });//pengy
		    
		    $("#lookfriends").click(function(){
	    		//var content="514";
	    		var user="<%=request.getParameter("user") %>";
	    		var content=$("#find").val();
	            var renum = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 
	    		
	    		if (renum.test(content)) {
	    			
	    		   param_data={
	    				'user':user,
	    				'phone':content
	    		   };
	    		   
	    		  $.ajax({        			
	    			type:"GET",
	    		    url:"/Schedule/findByphone.action",
	    		    contentType:"application/json;charset=utf-8",  
	    		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
	    		    data:{
	    		    	'param':JSON.stringify(param_data)
	    		    },
	    		    dataType:"json",
	    		    async:false,
	    		    success:function(result){
	    		    	if(result.code==1){
        		    			var data=result.data;
        		    			var img = '';
	             		    	if(data.avatar === undefined){
	             		    		img = '../img/touxiang.jpg';
	             		    	}else{
	             		    		img = '/image/'+data.avatar;
	             		    	}
        		    		    var tbl = "<div class='media' style='border-bottom:1px solid #e8e8e8'>"
		             			tbl+="<img class='mr-3' src='"+img+"' style='width:60px;height:60px;border-radius:50%;margin-top:12px;border:1px solid #e8e8e8'> "
		             			tbl+="<div class='media-body'style='position:relative'>"
		             			tbl+="<h5 class='mt-0' style='padding-top:20px;font-size:16px'>"+data.name+"</h5><p class='delete-phone' style='font-size:14px'>"+data.phone+"</p><input type='button' style='position:absolute;bottom:20px;right:10px'  class='drop float-right btn btn-primary btn-sm' value='删除'></div></div>" 	
	          		       $("#table_show").html(tbl);
        		    	}else{
        		    		$("#table_show").html("<div class='alert alert-danger' role='alert' style='margin-top:15px'>搜索不到用户</div>");
        		    	}
	    		    	
	    		     
	    		    }  //success	
	    		 });   //ajax
	    		
	    		}//if为数字根据手机查找
	    		else{
	    			param_data={
	        				'user':user,
	        				'name':content
	        		   };
	        		   
	        		  $.ajax({        			
	        			type:"GET",
	        		    url:"/Schedule/findByname.action",
	        		    contentType:"application/json;charset=utf-8",  
	        		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
	        		    data:{
	        		    	'param':JSON.stringify(param_data)
	        		    },
	        		    dataType:"json",
	        		    async:false,
	        		    success:function(result){
	        		    	if(result.code==1){
		    		    		var data=result.data;
		    		    		var tbl = "<ul class='list-unstyled'>";
		             		    for(var i=0;i<data.length;i++){
		             		    	var img = '';
		             		    	if(data[i].avatar === undefined){
		             		    		img = '../img/touxiang.jpg';
		             		    	}else{
		             		    		img = '/image/'+data[i].avatar;
		             		    	}
		             		    tbl += "<li class='media' style='border-bottom:1px solid #e8e8e8'>"
		             			tbl+="<img class='mr-3' src='"+img+"' style='width:60px;height:60px;border-radius:50%;margin-top:12px;border:1px solid #e8e8e8'> "
		             			tbl+="<div class='media-body'style='position:relative'>"
		             			tbl+="<h5 class='mt-0' style='padding-top:20px;font-size:16px'>"+data[i].name+"</h5><p class='delete-phone' style='font-size:14px'>"+data[i].phone+"</p><input type='button' style='position:absolute;bottom:20px;right:10px'  class='drop float-right btn btn-primary btn-sm' value='删除'></div></li>"
		             			
		             		 } 
		             		    tbl +="</ul>"
		          		       $("#table_show").html(tbl);  	
		    		      }else{
		    		    	    $("#table_show").html("<div class='alert alert-danger' role='alert' style='margin-top:15px'>搜索不到用户</div>"); 
		    		    	  }
	        		    	  	
	        		    }   //success     		    
	        		 });   //ajax
	    		}//else 根据姓名查找
	    		
	    	});//lookfriends
	    	
	    	
	    	$("#search").click(function(){
	    		var phone=$("#find2").val();
	    		
	    		$.ajax({        			
	    			type:"GET",
	    		    url:"/Schedule/addByphone.action",
	    		    contentType:"application/json;charset=utf-8",  
	    		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
	    		    data:{
	    		    	'phone':phone
	    		    },
	    		    dataType:"json",
	    		    async:false,
	    		    success:function(result){
	    		    	console.log(result)
	    		    	if(result.code==1){
	    		    		var data=result.data;
	    		    		var img = '';
             		    	if(data.avatar === undefined){
             		    		img = '../img/touxiang.jpg';
             		    	}else{
             		    		img = '/image/'+data.avatar;
             		    	}
	    		    		var tbl="<h5 style='font-size:16px;margin-top:15px'>您可能要找的是</h5>";
	    		    			
	    		    		    tbl += "<div class='media' style='border-bottom:1px solid #e8e8e8'>"
	    		    		    tbl+="<img class='mr-3' src='"+img+"' style='width:60px;height:60px;border-radius:50%;margin-top:12px;border:1px solid #e8e8e8'> "
		             			tbl+="<div class='media-body'style='position:relative'>"
		             			tbl+="<h5 class='mt-0' style='padding-top:20px;font-size:16px'>"+data.name+"</h5><p class='delete-phone' style='font-size:14px'>"+data.phone+"</p><input type='button' style='position:absolute;bottom:20px;right:10px'  class='drop float-right btn btn-primary btn-sm' value='添加' id='add'></div></div>" 	
	  		    	        
	            		     $("#findcontent").html(tbl);
	  		    	    	
	  		    	    	$("#add").click(function(){
	  		  	    		
	  		    	    		var user=data.user;
	  		  	    	        var send="<%=request.getParameter("user") %>";
	  		  	    	    var msg="请求加你为好友";
	  		  	    	    var param_data={
	  		  						  'user':user,
	  		  						  'send':send,
	  		  						  'msg':msg
	  		  				  };
	  		  	    	   
	  		  	    		$.ajax({        			
	  		  	    			type:"GET",
	  		  	    		    url:"/Schedule/AddMessage.action",
	  		  	    		    contentType:"application/json;charset=utf-8",  
	  		  	    		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
	  		  	    		    data:{
	  		  	    		    	'param':JSON.stringify(param_data)
	  		  	    		    },
	  		  	    		    dataType:"json",
	  		  	    		    async:false,
	  		  	    		    success:function(data){
	  		  	    		    	if(data.code==1){
	  		  	    		    		  alert("请求发送成功");	    
	  		  	    		    	}
	  		  	    		    	  	
	  		  	    		    }        		    
	  		  	    		});   //ajax
	  		  	    		
	  		  	   	
	  		  	      });//add
	            		     
	    		    	}else{
	    		    		 $("#findcontent").html("<div class='alert alert-danger' role='alert' style='margin-top:15px'>搜索不到用户</div>");
	    		    	}
	    		    	  	
	    		    }        		    
	    		});   //ajax
	    		
	    	});//search
	});
    </script>
     <script>
    	$(function(){
    		var user="<%=request.getParameter("user")%>";
    		var code = "<%=request.getParameter("code")%>";
    		if(code == 1){
    			
    		
    		$.ajax({        			
    			type:"GET",
    		    url:"/Schedule/findPerson.action",
    		    contentType:"application/json;charset=utf-8",  
    		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
    		    data:{
    		    	'user':user
    		    },
    		    dataType:"json",
    		    async:false,
    		    success:function(result){
    		   
    		    	 if(result.code==1){
    		    		
    		    		 var data=result.data;
    		    		 //console.log(data);
    		    		 var img = ""
        		    		 if(data.avatar === undefined){
        		    			 img = '../img/touxiang.jpg'
        		    		 }else{
        		    			 img = '/image/'+data.avatar
        		    		 }			        		    		  		    
             		 $("#left-name").html(data.name);
             		 $("#left-phone").html(data.phone);
             		 $(".touxiang").attr('src',img);
    		    	 }else if(result.code==-1){
    		    		 alert("获取用户失败");
    		    	 }      		    	
    		    }        		    
    		});
    		}else{
    			//alert('您还未登录');
    		}
    	});
    </script>
   
    <script>
    	$(function(){
    		
    		//获得今日的日程
    		function getNowTime() {
		        var date = new Date();
		        var seperator1 = "-";//年月日分隔符
		        var seperator2 = ":";//时分秒分隔符
		        var month = date.getMonth() + 1; //月份是0~11，要加1为当前月
		        var strDate = date.getDate();
		        if (month >= 1 && month <= 9) {
		            month = "0" + month;
		        }
		        if (strDate >= 0 && strDate <= 9) {
		            strDate = "0" + strDate;
		        }
		        var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate 
		        return currentdate;
		    }
    		
    		var user="<%=request.getParameter("user")%>";
    		var code = "<%=request.getParameter("code")%>";
    		 var param_datas={
                 	'user':user,
                 	'start_date':getNowTime()
                 }
    		 //console.log(param_datas);
    		 if(code == 1){
    			 $.ajax({
                 	type:"POST",
                     url:"${pageContext.request.contextPath }/selectSchedule.action",
                     data:{'param':JSON.stringify(param_datas)},
                     dataType:"json",
                     async:false,
                     success:function(data){
                     	//console.log(data)
                     	 var tbl = "";
                         if(data != ""){
        						
        						for(var i = 0;i<data.length;i++){
        							
        							tbl +="<div class='alert alert-warning alert-dismissible fade show' role='alert'>"
                                    tbl += "<strong>"+data[i].theme+"</strong>"
        							tbl += "<span class=' float-right' style='font-size:16px'>"+data[i].start_date+" "+data[i].start_time+"</span></div>"
        							
        						}
        						$('.today-schedule').html(tbl);
                    		}  		    	
                         else{
                        	 tbl = "<div class='alert alert-success' role='alert'>"
                        	 tbl += "<h4 class='alert-heading'>Well done!</h4> <hr>"
                        	 tbl += "<p class='mb-0'>You have no agenda for today,Enjoy the day.</p></div>"
                             $('.today-schedule').html(tbl);
                         }
                     }
                 });
    		 }else{
    			 //alert('您还未登录');
    		 }
    		 
    	});
    </script>
  
	 <script>
    $(function () {
		$("#shouye").click(function () {
			var code = "<%=request.getParameter("code")%>";
			
			
			if(code==1 ){
				location.href="../static/jsp/main.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			}
			
        });
		$("#schedu").click(function () {
			var code = "<%=request.getParameter("code")%>";
			
			if(code==1){
				location.href="schedule.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			}
			
        });
		$("#daojishi").click(function () {
			var code = "<%=request.getParameter("code")%>";
			
			if(code==1){
				location.href="backtime.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			}
			
        });

       $("#rob").click(function () {	
			var code = "<%=request.getParameter("code")%>";
			if(code==1){
					location.href="robot.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			} 					
        });	
       $("#message").click(function () {	
			var code = "<%=request.getParameter("code")%>";
			if(code==1){
				location.href="message.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			} 					
       });	
     $(".lianliankan").click(function(event){
    	   //event.preventDefault();
    	   var code = "<%=request.getParameter("code")%>";
			if(code==1){
				location.href="lianliankan.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			} 	
       });
       $(".pingtu").click(function(event){
    	   //event.preventDefault();
    	   var code = "<%=request.getParameter("code")%>";
			if(code==1){
				location.href="pingtu.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			} 	
       }); 
       $("#set").click(function(event){
    	   //event.preventDefault();
    	   var code = "<%=request.getParameter("code")%>";
			if(code==1){
				location.href="setinfo.jsp?code="+<%=request.getParameter("code")%>+"&user="+"<%=request.getParameter("user")%>";
			}
			else{
				alert("您还未登录！");
			} 	
       }); 
		
    });
    </script>
<title>时间安排</title>
</head>
<body >

			<div class="menu-wrap" >
						<div class="media" style="padding: 10px 50px;width: 300px;position:absolute;top:20px;left:0;border-bottom:1px solid #e8e8e8">
				            <img class="mr-3 touxiang" src="../../img/touxiang.jpg" style="width: 48px;height: 48px;border-radius: 50%">
				            <div class="media-body">
				                <h5 class="mt-0" style="font-size: 14px;color:#fff" id="left-name">未登录</h5>
				                <span style="font-size: 13px;color:#fff" id="left-phone"></span>
				            </div>
        				</div>
        			
						<div class="today-schedule" style="width:299px;position:absolute;top:93px;left:0;overflow:auto">
							
							
						</div>
  
				<div  class="out" style="position:absolute;left:15px;bottom:15px;font-size:14px">
					<a id="set" data-target="" href="#" style="margin-right:20px"><i class="iconfont" style="margin-right:5px">&#xe61c;</i><span>设置</span></a>
					<a id="loginout" data-target="" href="../static/jsp/main.jsp?code=0"><i class="iconfont" style="margin-right:5px">&#xe792;</i><span>退出</span></a>
				</div>
				
				<button class="close-button" id="close-button">Close Menu</button>
			</div>
<header>
        <nav class="navbar navbar-expand-lg navbar-dark bg-dark mynavbar">
            <div class="navbar-brand" ><button class="btn btn-dark" id="open-button" >个人中心</button></div>
            <div class="collapse navbar-collapse" id="navbarNavDropdown" style="margin-left: 100px">
                <ul class="navbar-nav">
                    <li class="nav-item active" id='shouye'>
                        <a class="nav-link" href="#" style="margin-left:200px">首页<span class="sr-only">(current)</span></a>
                    </li>
                    <li class="nav-item" id="schedu">
                        <a class="nav-link" href="#" >日程安排</a>
                    </li>
                    <li class="nav-item" id='daojishi'>
                        <a class="nav-link" href="#">倒计时</a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
                           小游戏
                        </a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
                            <a class="dropdown-item pingtu" href="#" id="pt" >拼图</a>
                            <a class="dropdown-item lianliankan" href="#" >连连看</a>
                        </div>
                    </li>
                    <li class="nav-item" id='rob'>
                        <a class="nav-link" href="#" >智能机器人</a>
                    </li>
                </ul>
            </div>
            <ul class="nav">
                <li class="nav-item">
                    <a class="nav-link disabled" id="message" href="#" style='color:#fff;'><i class="iconfont" style="margin-right:5px;font-size:18px">&#xe605;</i>消息</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link disabled" href="login.jsp" id="login" style='color:#fff;'><i class="iconfont" style="margin-right:5px">&#xe63a;</i>登录</a>
                </li>
            </ul>
        </nav>
    </header>
    
<div class="container-fluid" >
        <div class="row">
            <div class="content-left col-md-3 d-none d-lg-block" >
                <div class="content-left-weather ">
                    <iframe class="weather" name="weather_inc" src="http://i.tianqi.com/index.php?c=code&id=55"  width="255" height="294" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
                </div>
                <div class="">
                    <div class="jq22" style="width: 300px;margin-top: 35px;margin-left: 25px;margin-bottom: 60px">
                        <div id="calendar"></div>
                    </div>
                </div>
            </div>
            <div class=" col-md-9" style="margin-top: 8px">
            	<div>
            		<div class="card" style="width:750px">
						  <div class="card-body align-middle content-frenid-btn">
						    <button type="button" class="btn btn-warning friend-list"><i class="iconfont" style="margin-right:5px">&#xe625;</i>Friends</button>
						  </div>
						</div>
            	</div>
                <div class="content-right" style="margin-top:20px">
                	<div style=" height: 500px; width: 750px; margin-top: 15px">
					
		<div id="accordion">
    <div class="card">
        <div class="card-header" id="headingOne">
            <h5 class="mb-0">
                <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                   你收到的消息
                </button>
            </h5>
        </div>
        <div id="collapseOne" class="collapse show " aria-labelledby="headingOne" data-parent="#accordion" id="receivemsg">
           <div class="card-body" id="receivemsg">

                    
                </div>
        </div>
    </div>
    <div class="card">
        <div class="card-header" id="headingTwo">
            <h5 class="mb-0">
                <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                    好友申请
                </button>
            </h5>
        </div>
        <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
            <div class="card-body" id="request">

                    
                </div>
            </div>
        </div>
</div>
		
					
					
	</div>
	</div>
	</div>
                </div>
            </div>
	

			
				
	


<div class="avgrund-cover"></div>
<aside id="default-popup" class="avgrund-popup">
	<h2 style="font-size:18px">今日安排</h2>
	<div class="detail_content" style="height: 190px;overflow: auto" >
		
	</div>
	<button onClick="javascript:closeDialog();" class="btn btn-primary" style="position:absolute;bottom:10px;right:20px">Close</button>

</aside>
<div id="sideMenuContainer" style="min-width: 320px">
  <ul class="nav justify-content-center" id="myTab" role="tablist" style="border-bottom: 1px solid #e8e8e8;">
    <li class="nav-item">
        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">好友列表</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">查找好友</a>
    </li>
</ul>
<div class="tab-content" id="myTabContent">
    <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab" style="margin-top:15px">
    	<form class="form-inline my-2 my-lg-0">
	      <input class="form-control mr-sm-2" type="search" placeholder="输入电话或姓名搜索" aria-label="Search" name="find" id="find" >
	      <button class="btn btn-outline-success my-2 my-sm-0" type="button" id="lookfriends">Search</button>
	    </form>
    	<div id="table_show" style="overflow:auto"></div>
    </div>
    <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab" style='margin-top:15px;margin-left:8px'>
	    <form class="form-inline my-2 my-lg-0">
	      <input class="form-control mr-sm-2" type="search" placeholder="输入电话搜索" aria-label="Search" name="find" id="find2">
	      <button class="btn btn-outline-success my-2 my-sm-0" type="button" id="search">Search</button>
	    </form>
	    <div id="findcontent"></div>
	</div>
</div>
  
</div>
<script type="text/javascript">
	$(document).ready(function(){
	  $('.friend-list').sideToggle({
		moving: '#sideMenuContainer',
		direction: 'right'
	  });
	});
	</script>
<script type="text/javascript">
	   $(document).ready(function(){
		  
		  		
		   var user="<%=request.getParameter("user") %>";

		  		$.ajax({        			
		  			type:"GET",
		  		    url:"/Schedule/SelectMessage.action",
		  		    contentType:"application/json;charset=utf-8",  
		  		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		  		    data:{
		  		    	'user':user
		  		    },
		  		    dataType:"json",
		  		    async:false,
		  		    success:function(result){
		  		    	   
		  		    	    if(result.code==1){
		  		    	    	var data=result.data;
		  		    	    	var tbl="<ul class='list-group'><li class='list-group-item align-items-center' style='position:relative'>发送人<span class='' style='position:absolute;left:200px'>信息</span></li>"
		  		    	    	for(var i=0;i<data.length;i++){
		  		    	    		tbl+="<li class='list-group-item align-items-center' style='position:relative'>"+data[i].send+"<span class='' style='position:absolute;left:200px'>"+data[i].msg+"</span></li>";
		  		    	    	}
		  		    	    	
		  		    	    	tbl+="</ul>";
		  		    	    	
		  		    	    	   		    	
		            		   $("#receivemsg").html(tbl);
		  		    	    }
		  		    }        		    
		  		});   //ajax
		  		
		  		
		  		$.ajax({        			
		  			type:"GET",
		  		    url:"/Schedule/SelectReqMessage.action",
		  		    contentType:"application/json;charset=utf-8",  
		  		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		  		    data:{
		  		    	'user':user
		  		    },
		  		    dataType:"json",
		  		    async:false,
		  		    success:function(result){
		  		    	   
		  		    	    if(result.code==1){
		  		    	    	var data=result.data;
		  		    	    	var tbl="<ul class='list-group'><li class='list-group-item align-items-center' style='position:relative'>发送人<span class='' style='position:absolute;left:200px'>申请</span></li>"
			  		    	    	for(var i=0;i<data.length;i++){
			  		    	    		tbl+="<li class='list-group-item align-items-center' style='position:relative'><span>"+data[i].send+"</span><span class='' style='position:absolute;left:200px'>"+data[i].msg+"</span><input type='button' id='add' class='maybebtn btn btn-success btn-sm agree float-right' value='同意'  style='position:absolute;right:100px;'><input type='button' id='add' class='maybebtn btn btn-danger btn-sm refuse float-right' value='拒绝'  style='margin-left:380px'></li>";
			  		    	    	}
			  		    	    	
			  		    	    	tbl+="</ul>";
		  		    	    	
		  		    	    	   		    	
		            		   $("#request").html(tbl);

		            		  
		  		    	    }
		  		    	    
		  		    }        		    
		  		});   //ajax
		  		
		  		$(".agree").click(function(){
		  			 
		  			var user=$(this).parent().children('span').eq(0).html();
		  			console.log(user);
		  		  //alert(user);
		  		    var send="<%=request.getParameter("user")%>";
		  		    var msg="同意了你的好友请求";
		  		    var param_data={
		  					  'user':user,
		  					  'send':send,
		  					  'msg':msg
		  			  };
		  		   
		  			$.ajax({        			
		  				type:"GET",
		  			    url:"/Schedule/AddMessage.action",
		  			    contentType:"application/json;charset=utf-8",  
		  			    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		  			    data:{
		  			    	'param':JSON.stringify(param_data)
		  			    },
		  			    dataType:"json",
		  			    async:false,
		  			    success:function(data){
		  			    	if(data.code==1){
		  			    	    alert("回复同意成功");
		  			    	}
		  			    }        		    
		  			});   //ajax
		  		});//agree
		  		
		  		$(".agree").click(function(){
		  			var user=$(this).parent().children('span').eq(0).html();
		  			  var send="<%=request.getParameter("user")%>";
		  			    var request="1";
		  			    var param_data={
		  						  'user':user,
		  						  'send':send,
		  						  'request':request
		  				  };
		  			   
		  				$.ajax({        			
		  					type:"GET",
		  				    url:"/Schedule/AddFriends.action",
		  				    contentType:"application/json;charset=utf-8",  
		  				    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
		  				    data:{
		  				    	'param':JSON.stringify(param_data)
		  				    },
		  				    dataType:"json",
		  				    async:false,
		  				    success:function(data){
		  				    	if(data.code==1){
		  				    		//alert("回复同意成功");	    	
		  				    }
		  				    }
		  				});   //ajax
		  			
		  		});//agree
		  		
		  		$(".agree").click(function(){
		  			var user="<%=request.getParameter("user")%>";
				    
		  			var send=$(this).parent().children('span').eq(0).html();
				    
				    var request="1";
				    var param_data={
							  'user':user,
							  'send':send,
							  'request':request
					  };
				   
					$.ajax({        			
						type:"GET",
					    url:"/Schedule/AddFriends.action",
					    contentType:"application/json;charset=utf-8",  
					    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
					    data:{
					    	'param':JSON.stringify(param_data)
					    },
					    dataType:"json",
					    async:false,
					    success:function(data){
					    	if(data.code==1){
					    		//alert("请求同意成功");	   
					    	}
					    		 	
					    }        		    
					});   //ajax
		  			
		  		});//agree
		  		
		  		
		  	//删除消息表里面的好友请求
	      		  $(".agree").click(function(){
			  		  
			  		 
			  		  
	      			    var user="<%=request.getParameter("user") %>";
	      			    var send=$(this).parent().children('span').eq(0).html();
	      		  	    var msg= $(this).parent().children('span').eq(1).html();
	      		  	    var param_data={
	      							  'user':user,
	      							  'send':send,
	      							  'msg':msg
	      					  };
	      		  	   
	      		  		$.ajax({        			
	      		  			type:"GET",
	      		  		    url:"/Schedule/deleteMsg.action",
	      		  		    contentType:"application/json;charset=utf-8",  
	      		  		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
	      		  		    data:{
	      		  		    	'param':JSON.stringify(param_data)
	      		  		    },
	      		  		    dataType:"json",
	      		  		    async:false,
	      		  		    success:function(data){
	      		  		    	if(data.code==1){
	      		  		    		 // alert("加好友请求删除成功");	    
	      		  		    	}
	      		  		    	  	
	      		  		    }        		    
	      		  		});   //ajax
	      		  		
	      		 	
	      		    });//agree
		  		
		  		 $(".refuse").click(function(){
		  		  var name= $(this).parent().children('span').eq(0).html();
		  		  
		  		  //alert(name);
      			    var user=name;
      		  	    var send="<%=request.getParameter("user") %>";
      		  	    var msg="拒绝了你的请求";
      		  	    var param_data={
      							  'user':user,
      							  'send':send,
      							  'msg':msg
      					  };
      		  	   
      		  		$.ajax({        			
      		  			type:"GET",
      		  		    url:"/Schedule/AddMessage.action",
      		  		    contentType:"application/json;charset=utf-8",  
      		  		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
      		  		    data:{
      		  		    	'param':JSON.stringify(param_data)
      		  		    },
      		  		    dataType:"json",
      		  		    async:false,
      		  		    success:function(data){
      		  		    	if(data.code==1){
      		  		    		  alert("拒绝发送成功");	    
      		  		    	}
      		  		    	  	
      		  		    }        		    
      		  		});   //ajax
      		  		
      		 	
      		    });//refuse
      		    
      		    //删除消息表里面的好友请求
      		  $(".refuse").click(function(){
		  		  
		  		 
		  		  
      			    var user="<%=request.getParameter("user") %>";
      			  	var send=$(this).parent().children('span').eq(0).html();
    		  	    var msg= $(this).parent().children('span').eq(1).html();
      		  	    var param_data={
      							  'user':user,
      							  'send':send,
      							  'msg':msg
      					  };
      		  	   
      		  		$.ajax({        			
      		  			type:"GET",
      		  		    url:"/Schedule/deleteMsg.action",
      		  		    contentType:"application/json;charset=utf-8",  
      		  		    //我们使用 JSON.stringify() 方法处理json，将其转换为字符串；
      		  		    data:{
      		  		    	'param':JSON.stringify(param_data)
      		  		    },
      		  		    dataType:"json",
      		  		    async:false,
      		  		    success:function(data){
      		  		    	if(data.code==1){
      		  		    		  //alert("加好友请求删除成功");	    
      		  		    	}
      		  		    	  	
      		  		    }        		    
      		  		});   //ajax
      		  		
      		 	
      		    });//refuse
		  		
		 	
	   });
    </script>
    
    <script src="${pageContext.request.contextPath }/static/js/classie.js"></script>
	<script src="${pageContext.request.contextPath }/static/js/main.js"></script>
</body>
</html>